<?php
namespace jy_merch;
defined('BY_JYA') or exit('error');
/*
	本插件：$this->model('model')->方法名();
	其他地方调用：model('jy_merch/model')->方法名();
*/
class games extends \plugin{
	public function getall($merchid=0){
		$list = array(
			'jy_merchtool_tb'=>array('name'=>'jy_merchtool_tb','title'=>'填表登记','unit'=>'填表','desc'=>'信息收集统计','icon'=>'icon-dingdan',),
			'jy_merchtool_bm'=>array('name'=>'jy_merchtool_bm','title'=>'活动报名','unit'=>'报名','desc'=>'聚会 培训 会议','icon'=>'icon-dingdan',),
			'jy_merchtool_yy'=>array('name'=>'jy_merchtool_yy','title'=>'服务预约','unit'=>'预约','desc'=>'商家服务预约','icon'=>'icon-dingdan',),
			'jy_merchtool_tz'=>array('name'=>'jy_merchtool_tz','title'=>'通知公告','unit'=>'通知','desc'=>'公告 通知信息','icon'=>'icon-dingdan',),
			'jy_merchtool_vote'=>array('name'=>'jy_merchtool_vote','title'=>'投票评选','unit'=>'投票','desc'=>'投票 排名','icon'=>'icon-dingdan',),
			'jy_merchtool_wj'=>array('name'=>'jy_merchtool_wj','title'=>'问卷调查','unit'=>'问卷','desc'=>'投诉反馈','icon'=>'icon-survey',),
			'jy_merchtool_fee'=>array('name'=>'jy_merchtool_fee','title'=>'费用收集','unit'=>'费用','desc'=>'集体/班级收款/社群捐款','icon'=>'icon-dingdan',),
			'jy_merchtool_red'=>array('name'=>'jy_merchtool_red','title'=>'红包接龙','unit'=>'红包','desc'=>'裂变红包/随机抽取红包','icon'=>'icon-dingdan',),
			'jy_merchtool_gq'=>array('name'=>'jy_merchtool_gq','title'=>'供求信息','unit'=>'供求','desc'=>'供求信息的发布、周边信息','icon'=>'icon-dingdan',),
			'jy_merchtool_car'=>array('name'=>'jy_merchtool_car','title'=>'停车预约','unit'=>'预约','desc'=>'商家停车预约','icon'=>'icon-qiche',),
			'jy_merchgame_ms'=>array('name'=>'jy_merchgame_ms','title'=>'秒杀活动','unit'=>'秒杀','desc'=>'促销保单利器','icon'=>'',),
			'jy_merchgame_fx'=>array('name'=>'jy_merchgame_fx','title'=>'分销活动','unit'=>'分销','desc'=>'促销保单利器','icon'=>'',),
			'jy_merchgame_pt'=>array('name'=>'jy_merchgame_pt','title'=>'拼团活动','unit'=>'拼团','desc'=>'促销保单利器','icon'=>'',),
			'jy_merchgame_tg'=>array('name'=>'jy_merchgame_tg','title'=>'团购活动','unit'=>'团购','desc'=>'促销保单利器','icon'=>'',),
			'jy_merchgame_cj'=>array('name'=>'jy_merchgame_cj','title'=>'抽奖活动','unit'=>'抽奖','desc'=>'促销保单利器','icon'=>'',),
			'jy_merchgame_bm'=>array('name'=>'jy_merchgame_bm','title'=>'帮卖活动','unit'=>'帮卖','desc'=>'促销保单利器','icon'=>'',),
			'jy_merchgame_bao'=>array('name'=>'jy_merchgame_bao','title'=>'付费报名','unit'=>'报名','desc'=>'发起团活动报名','icon'=>'',),
		);
		return  $list;
	}
	public function checkup($merchid=0,$name='',$isexi=0){
		$pluginset=pdo_getcolumn('jy_merch_user',array('id'=>$merchid,'uniacid'=>$_SESSION['uniacid']),'pluginset');
		$pluginset=$pluginset?json_decode($pluginset,true):array('isopen'=>0);
		$games=$pluginset['games'];
		if(!$games){
			$groupid=pdo_getcolumn('jy_merch_user',array('id'=>$merchid,'uniacid'=>$_SESSION['uniacid']),'groupid');	
			$games=pdo_getcolumn('jy_merch_group',array('id'=>$groupid,'uniacid'=>$_SESSION['uniacid']),'games');	
		}
		if($games){
			$check=strexists($games,';'.$name.';');	
			if(!$check){
				if($isexi){
						exi('没有访问权限','error',$group['menus'][0]['action']);
				}else{
					return false;	
				}
			}
		}
		return true;
	}
}